<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /* 4.已知一个查询字符串组成的对象{
                user:'laoli',
                pass:123,
                score:100,
            } */

        var obj = {
            user: 'laoli',
            pass: 123,
            score: 100
        },
        str = "http://www.baidu.com?";

        for (var key in obj){
            str += key + '=' + obj[key] + '&';
        }

        console.log(str.slice(0, -1));
        
    </script>
</body>

</html>